/* Replication package for 
   "Explaining How Human Rights Protections Change After Internal Armed Conflicts"
   Johannes Karreth, Patricia L. Sullivan, Ghazal Dezfuli
   November 30, 2019
   jkarreth@ursinus.edu 

   This file: PC-HRP_Main-Analysis.do
   Purpose: Data analysis and tables 
   Also see: PC_HRP_Figures.R for figures */

version 13.1   

import delimited "PC-HRP.csv", clear

/* Summary statistics */

estpost summarize hrpchange civtarget_both govcas_high yrs_post hrp_pre10 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln
esttab using tablea1.rtf, cells("count mean sd min max") replace 

/* 
Hypotheses: 
H1: Holding pre-conflict levels of human rights protections constant, the level 
of human rights protection will be lower after wars in which the combatants 
targeted civilians. */

/* 
civtarget_both: 
0 = none, 
1 = govt only, 
3 =  both (+3 cases coded rebel only) */

* Full model
mixed hrpchange i.civtarget_any govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: , vce(cluster ccode) 
est store h1m0

mixed hrpchange i.civtarget_both govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: , vce(cluster ccode) 
est store h1m1

outreg2 [h1m0 h1m1] using table1.doc, alpha(0.1) symbol(*) dec(2) replace word

* Robustness test: vary time window for pre-conflict HRP other than 5
mixed hrpchange_pre10 i.civtarget_both govcas_high yrs_post hrp_pre10 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: , vce(cluster ccode) 
est store h1m1c10

mixed hrpchange_pre9 i.civtarget_both govcas_high yrs_post hrp_pre9 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: , vce(cluster ccode) 
est store h1m1c9

mixed hrpchange_pre8 i.civtarget_both govcas_high yrs_post hrp_pre8 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: , vce(cluster ccode) 
est store h1m1c8

mixed hrpchange_pre7 i.civtarget_both govcas_high yrs_post hrp_pre7 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: , vce(cluster ccode) 
est store h1m1c7

mixed hrpchange_pre6 i.civtarget_both govcas_high yrs_post hrp_pre6 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: , vce(cluster ccode) 
est store h1m1c6

* Table with robustness tests
outreg2 [h1m1c10 h1m1c9 h1m1c8 h1m1c7 h1m1c6] using tablea4.doc, alpha(0.1) symbol(*) dec(2) replace word

* Robustness test: restrict to 5/6/7/8/9 post-conflict years instead of 10
mixed hrpchange i.civtarget_both govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: if yrs_post <= 9, vce(cluster ccode)
est store h1m1d9

mixed hrpchange i.civtarget_both govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: if yrs_post <= 8, vce(cluster ccode)
est store h1m1d8

mixed hrpchange i.civtarget_both govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: if yrs_post <= 7, vce(cluster ccode)
est store h1m1d7

mixed hrpchange i.civtarget_both govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: if yrs_post <= 6, vce(cluster ccode)
est store h1m1d6

mixed hrpchange i.civtarget_both govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: if yrs_post <= 5, vce(cluster ccode)
est store h1m1d5

* Table with robustness tests
outreg2 [h1m1d9 h1m1d8 h1m1d7 h1m1d6 h1m1d5] using tablea5.doc, alpha(0.1) symbol(*) dec(2) replace word

* Robustness test: control for change in GDP per capita as proxy for grievances after conflict
mixed hrpchange i.civtarget_both govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln gle_rgdpc_change_pre5 || conflictid:, vce(cluster ccode)
est store h1m1e

* Robustness test: control for victory
mixed hrpchange i.civtarget_both govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln i.conflictoutcome || conflictid:, vce(cluster ccode)
est store h1m1f

* Table with robustness tests
outreg2 [h1m1e h1m1f] using tablea6.doc, alpha(0.1) symbol(*) dec(2) replace word

* Robustness test: collapse to post-conflict period (i.e. year 1)
bysort conflictid: egen hrpdiff_postmean = mean(hrpdiff)

reg hrpdiff_postmean i.civtarget_both govcas_high hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: if yrs_post == 1, vce(cluster ccode)
est store h1m2_post
outreg2 [h1m2_post] using tablea2.doc, alpha(0.1) symbol(*) dec(2) replace word

/* 
H2: Post-conflict human rights conditions will remain poor, or be further 
degraded from pre-conflict levels, when a government that engaged in widespread 
targeting of civilians during the war remains in power after war 
termination. 
H3: Post-conflict human rights conditions will remain poor, or be further 
degraded from pre-conflict levels, when a rebel-led government seizes power from 
a regime that engaged in extensive targeting of civilians during the war.
*/

* Full model
mixed hrpchange i.civtarget_gov##i.govcomp4 govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: , vce(cluster ccode)
est store h2h3m1b
outreg2 [h2h3m1b] using table2.doc, alpha(0.1) symbol(*) dec(2) replace word

/* 1 = Insurgents 
   2 = Government 
   3 = Powersharing
   4 = Unclear or failed state*/

quietly mixed hrpchange i.civtarget_gov##i.govcomp4 govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: , vce(cluster ccode)
contrast r.civtarget_gov@govcomp4, mcompare(noadjust) effects post level(90)
outreg2 using table3_contrast_targeting.doc, word replace ctitle(Difference in HRP change) dec(2)

* Robustness test: use 10-year window for pre-conflict HRP
quietly mixed hrpchange_pre10 i.civtarget_gov##i.govcomp4 govcas_high yrs_post hrp_pre10 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: , vce(cluster ccode)
contrast r.civtarget_gov@govcomp4, mcompare(noadjust) effects post level(90)

* Robustness test: restrict to 5 post-conflict years
quietly mixed hrpchange i.civtarget_gov##i.govcomp4 govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: if yrs_post <= 5, vce(cluster ccode)
contrast r.civtarget_gov@govcomp4, mcompare(noadjust) effects post level(90)

* Robustness test: replace govcomp4 with conflictoutcome (for memo)
quietly mixed hrpchange i.civtarget_gov##i.conflictoutcome govcas_high yrs_post hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: if yrs_post <= 5, vce(cluster ccode)
contrast r.civtarget_gov@conflictoutcome, mcompare(noadjust) effects post level(90)


* Robustness test: collapse to post-conflict period (i.e. year 1)
reg hrpdiff_postmean i.civtarget_gov##i.govcomp4 govcas_high hrp_pre5 chga_demo_prestyr gle_pop_ln pol_exconst recur gle_gdp_ln || conflictid: if yrs_post == 1, vce(cluster ccode)
est store h2h3m1y1
outreg2 [h2h3m1y1] using tablea3.doc, alpha(0.05) symbol(*) dec(2) replace word

quietly reg hrpdiff_postmean i.civtarget_gov##i.govcomp4 govcas_high hrp_pre5 chga_demo_prestyr pol_exconst recur gle_gdp_ln gle_pop_ln || conflictid: if yrs_post == 1, vce(cluster ccode)
contrast r.civtarget_gov@govcomp4, mcompare(noadjust) effects post
outreg2 using tablea3_contrast_targeting.doc, word replace ctitle(Difference in HRP change)
